package cn.edu.javaweb.superServlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.javaweb.utils.DBUtil;

@WebServlet("/SelectHiddenComment")
public class SelectHiddenComment extends HttpServlet {
	DBUtil db; //声明对象 一定要赋值  否则空指针异常
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		db=new DBUtil(); //建创对象 搭桥配置初始化
		String sql="select *from comment where hidden=1";  //写入sql语句
		System.out.println(sql);//打印sql语句
		
		List list = db.getList(sql);
		request.setAttribute("List", list);
		System.out.println(list); 
		//response.sendRedirect("volunteer/super/CollageAdmin.jsp");
		request.getRequestDispatcher("volunteer/super/HiddenComment.jsp").forward(request, response); 
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response); 
	}

}
